package one_class_design.two_work;

/**
 * @author 北巷_东坡
 * @date 2022/9/16 19:54
 * @computer 10741
 */
public class SongGame implements CompurerAverage{
    @Override
    public double average(double[] x) {
        int count = x.length;
        double aver = 0,temp = 0;
        for (int i = 0; i < count; i++) {
            for (int j = 0; j < count; j++) {
                if (x[j] < x[i]) {
                    temp = x[j];
                    x[j] = x[i];
                    x[i] = temp;
                }
            }
        }
        for (int i = 0; i < count - 1; i++) {
            aver =aver = x[i];
        }
        if (count > 2) aver = aver / (count - 2);
        else {
            aver = 0;
        }
        return aver;
    }
}
